import { RewardFactory } from '../../model/reward/factory';
import { CONDITION_TYPE } from '../../systems/condition-checker/type';
import { ITEM_ID } from '../item';
import {
  SECT_JOB,
  SECT_JOB_NUMBER,
  SECT_LEVEL,
  SECT_TAG,
  type SectConfig,
  type SectScriptureHallConfig,
} from './type';

export const SECT_ID = {
  /** 长生宗 */
  CHANGE_SHENG_ZONG: 'CHANGE_SHENG_ZONG',
} as const;

export type SectId = (typeof SECT_ID)[keyof typeof SECT_ID];

export const DEFAULT_SCRIPTURE_HALL: SectScriptureHallConfig[] = [
  {
    contribution: 1000,
    exchangeCondition: [
      {
        type: CONDITION_TYPE.SECT_JOB,
        job: SECT_JOB_NUMBER[SECT_JOB.INNER_DISCIPLE],
      },
    ],
    reward: RewardFactory.createItemReward({
      itemId: ITEM_ID.GUI_YUAN_YANG_QI_PIAN,
      quantity: 1,
    }),
  },
  {
    contribution: 1000,
    exchangeCondition: [
      {
        type: CONDITION_TYPE.SECT_JOB,
        job: SECT_JOB_NUMBER[SECT_JOB.INNER_DISCIPLE],
      },
    ],
    reward: RewardFactory.createItemReward({
      itemId: ITEM_ID.WAN_XIANG_GUAN_XIANG_FA,
      quantity: 1,
    }),
  },
  {
    contribution: 1000,
    exchangeCondition: [
      {
        type: CONDITION_TYPE.SECT_JOB,
        job: SECT_JOB_NUMBER[SECT_JOB.INNER_DISCIPLE],
      },
    ],
    reward: RewardFactory.createItemReward({
      itemId: ITEM_ID.JIU_ZHUAN_ZHU_JI_JUE,
      quantity: 1,
    }),
  },
];

export const SECT_DATA: SectConfig[] = [
  {
    id: SECT_ID.CHANGE_SHENG_ZONG,
    name: '长生宗',
    description:
      '长生宗，云渊古脉，凡有灵根皆可入，修《万古长春诀》，求万古长青。',
    level: SECT_LEVEL.SECT_LEVEL_01,
    tags: new Set([SECT_TAG.LIAN_DAN, SECT_TAG.COMMON]),
    conditions: [
      {
        type: CONDITION_TYPE.REALM,
        realm: 1,
      },
    ],
    scriptureHall: [
      ...DEFAULT_SCRIPTURE_HALL,
      {
        contribution: 1000,
        exchangeCondition: [
          {
            type: CONDITION_TYPE.SECT_JOB,
            job: SECT_JOB_NUMBER[SECT_JOB.INNER_DISCIPLE],
          },
        ],
        reward: RewardFactory.createItemReward({
          itemId: ITEM_ID.CHANG_CHUN_GONG,
          quantity: 1,
        }),
      },
      {
        contribution: 10000,
        exchangeCondition: [
          {
            type: CONDITION_TYPE.SECT_JOB,
            job: SECT_JOB_NUMBER[SECT_JOB.SUPER_ELDER],
          },
        ],
        reward: RewardFactory.createItemReward({
          itemId: ITEM_ID.WAN_GU_CHANG_CHUN_JUE,
          quantity: 1,
        }),
      },
    ],
  },
];
